*******************************************************************************
 *																			  *
 *							---	Master File	---								  *
 *																			  *
 * 		  "THE CENTRAL ROLE OF THE ASK GAP IN GENDER PAY INEQUALITY"		  *
 *								Nina Roussille								  * 
*******************************************************************************
 
 
 /* General Comments
  
 This Master file creates the following output:
	- The analysis sample set in "Construction.do"
	- The Main Output in "Main_Figures.do" and "Main_Tables.do"
	- The Appendix Output in "Appendix_Ouput.do"
 
 Once you have specified the relevant folder paths in the globals below, running the 
 master file will produce all the figures and tables for the main paper and the 
 appendix (but Figure C1 and Table C1, that are coded in R)
  
 Stata Version 16.1
  
 */

  
 * Packages needed:
 global firsttime 0 // change to 1 to install packages
 if $firsttime == 0 {
	 ssc install psacalc
	 ssc install ivreg2
	 ssc install xtivreg2
	 ssc install coefplot
	 ssc install binscatter
	 ssc install reghdfe
	 ssc install ftools 
	 ssc install ranktest
 }
 

/* it is possible that you will need to install the xfill command.
use "net from https://www.sealedenvelope.com/", then click
on xfill, and in the pop up that will open click on 'click here to install'
*/ 

* Clean slate

	clear all
	clear matrix
	scalar drop _all
	set more off
	macro drop _all
 
 * Datapaths (Input required): 
	
	set scheme modern

	if c(os) == "MacOSX" gl user "/Users/`c(username)'"
	else if c(os) == "Windows" gl user "C:\Users\\`c(username)'"
	else if c(os) == "Unix" gl user "/usr/`c(username)'"
	di "$user"
	
	* Defining path for respective folders here (adapt!): 
	global dofile 	"$user/Dropbox/askgap/replication/Code" 									/* Please, specify path for .do files */	
	global data 	"$user/Dropbox/askgap/replication/Data" 								/* Please, specify path for data */	
	global indata 	"$user/Dropbox/askgap/replication/InputData" 								/* Please, specify path for input data */	
	global graphs 	"$user/Dropbox/askgap/replication/Figures"							/* Please, specify path for Figure outputs */
	global tables 	"$user/Dropbox/askgap/replication/Tables"								/* Please, specify path for Table outputs */

	
 ****************************************************************************** 
 
 * 0. Construction file
	run "$dofile/Construction.do"	
 
 * 1. Define globals 
	run "$dofile/Globals.do"	
	
 * 2. Create Main Figures
	run "$dofile/Main_Figures.do"
	
 * 3. Create Main Tables
	run "$dofile/Main_Tables.do"
	
 * 4. Create Output for Appendix
	run "$dofile/Appendix_Output.do"
 
 
 
